<html>
<head>
  <script type="text/javascript" src="jquery-1.7.2.min.js"></script>
  <script type="text/javascript" src="jquery.ba-hashchange.min.js"></script>
  <script language="javascript" type="text/javascript">
  
  
  $(function(){
  
  // Bind an event to window.onhashchange that, when the hash changes, gets the
  // hash and adds the class "selected" to any matching nav link.
  $(window).hashchange( function(){
    var hash = location.hash;
    
    // Set the page title based on the hash.
    document.title = 'The hash is ' + ( hash.replace( /^#/, '' ) || 'blank' ) + '.';
    
    // Iterate over all nav links, setting the "selected" class as-appropriate.
    $('#nav a').each(function(){
      var that = $(this);
      that[ that.attr( 'href' ) === hash ? 'addClass' : 'removeClass' ]( 'selected' );
    });
	if(hash === "#test1"){
	$("#test").load("test2.php");
	}
  })
  
  // Since the event is only triggered when the hash changes, we need to trigger
  // the event now, to handle the hash the page may have loaded with.
  $(window).hashchange();
  
  });
  
  
  </script>
</head>
<body>
  <p id="nav">
  <a href="#test1">Test 1</a>
  <a href="#test2">Test 2</a>
  </p>
  <div id="test"></div>
</body>
</html>

